/**
 * Project:   dtu.fmes.googleloon
 * File:      Time.java
 * License: 
 *            This file is licensed under GNU General Public License version 3
 *            http://www.gnu.org/licenses/gpl-3.0.txt
 *
 * Copyright: Bartosz Cichecki [ cichecki.bartosz@gmail.com ]
 * Date:      Oct 12, 2013
 */

package dtu.fmes.loon.model.environment;

/**
 * Time parameters of the environment.
 * 
 * @author Bartosz Cichecki
 * 
 */
public class Time {

	/**
	 * Cycle ySize in seconds. By default 24h = 86 400 s.
	 */
	protected long cycleLength = 86400L;

	/**
	 * Specifies at which second of each cycle the night ends.
	 */
	protected long nightEndTime;

	/**
	 * Specifies at which second of each cycle the night starts.
	 */
	protected long nightStartTime;

	public Time() {

	}

	public Time(long cycleLength, long nightEndTime, long nightStartTime) {
		this.cycleLength = cycleLength;
		this.nightEndTime = nightEndTime;
		this.nightStartTime = nightStartTime;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		Time other = (Time) obj;
		if (cycleLength != other.cycleLength) {
			return false;
		}
		if (nightEndTime != other.nightEndTime) {
			return false;
		}
		if (nightStartTime != other.nightStartTime) {
			return false;
		}
		return true;
	}

	public long getCycleLength() {
		return cycleLength;
	}

	public long getNightEndTime() {
		return nightEndTime;
	}

	public long getNightStartTime() {
		return nightStartTime;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (int) (cycleLength ^ cycleLength >>> 32);
		result = prime * result + (int) (nightEndTime ^ nightEndTime >>> 32);
		result = prime * result + (int) (nightStartTime ^ nightStartTime >>> 32);
		return result;
	}

	public void setCycleLength(long cycleLength) {
		this.cycleLength = cycleLength;
	}

	public void setNightEndTime(long nightEndTime) {
		this.nightEndTime = nightEndTime;
	}

	public void setNightStartTime(long nightStartTime) {
		this.nightStartTime = nightStartTime;
	}

	@Override
	public String toString() {
		return "Time [cycleLength=" + cycleLength + ", nightEndTime=" + nightEndTime + ", nightStartTime=" + nightStartTime + "]";
	}

}
